package com.itxg.booksmanage.controller;

import com.itxg.booksmanage.common.R;
import com.itxg.booksmanage.service.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


/**
 * 统计数据
 */
@RestController
@RequestMapping("/stat")
public class StatController {

    @Resource
    private AuthorPriceService authorPriceService;

    @Resource
    private SortPriceService sortPriceService;

    @Resource
    private TypePriceService typePriceService;

    @Resource
    private LiteratureService literatureService;

    @Resource
    private LadarService ladarService;

    @Resource
    private BookService bookService;


    @GetMapping("/ap")
    public R getAP() {
        return R.success(authorPriceService.list());
    }

    @GetMapping("/sp")
    public R getSP() {
        return R.success(sortPriceService.list());
    }

    @GetMapping("/tp")
    public R getTP() {
        return R.success(typePriceService.list());
    }

    // Literature
    @GetMapping("/lr")
    public R getLR() {
        return R.success(literatureService.list());
    }

    // Ladar
    @GetMapping("/ld")
    public R getLD() {
        return R.success(ladarService.list());
    }

    // Scatter
    @GetMapping("/all")
    public R getScat() {
        return R.success(bookService.list());
    }


}
